package com.xueba.framework.domain.course;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author Kidy
 * @date 2020/7/31 10:20
 */
@Data
@ToString
@Entity
@NoArgsConstructor
@Table(name = "teachplan_media_pub")
@GenericGenerator(name = "jpa-assigned", strategy = "assigned")
@Document(indexName = "xc_course_media", shards = 1, replicas = 0)
public class TeachplanMediaPub implements Serializable {
    private static final long serialVersionUID = -916357110051689485L;
    @Id
    @GeneratedValue(generator = "jpa-assigned")
    @Column(name = "teachplan_id")
    @Field(name = "teachplan_id", type = FieldType.Keyword)
    private String teachplanId;

    @Column(name = "media_id")
    @Field(name = "media_id", type = FieldType.Keyword)
    private String mediaId;

    @Column(name = "media_fileoriginalname")
    @Field(name = "media_fileoriginalname", type = FieldType.Text, index = false)
    private String mediaFileOriginalName;

    @Column(name = "media_url")
    @Field(name = "media_url", type = FieldType.Text, index = false)
    private String mediaUrl;

    @Column(name = "courseid")
    @Field(name = "courseid", type = FieldType.Keyword)
    private String courseId;

    @Column(name = "timestamp")
    @Field(type = FieldType.Date, format = DateFormat.date_time)
    private Date timestamp;
}
